﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace WhatTheHelp.Demo.Attachables
{
    public class WTHManager
    {
        #region HelpContext Property

        /// <summary>
        /// Attached property for WTHManager to set the HelpContext
        /// </summary>
        public static readonly DependencyProperty HelpContextProperty = DependencyProperty.RegisterAttached(
              "HelpContext",
              typeof(string),
              typeof(WTHManager),
              null);

        public static void SetHelpContext(DependencyObject obj, string propertyValue)
        {
            obj.SetValue(HelpContextProperty, propertyValue);

            //Hook up the mouse click
            if (obj is FrameworkElement)
            {
                ((FrameworkElement)obj).MouseLeftButtonDown += triggerHelp;
            }
        }

        public static string GetHelpContext(DependencyObject obj)
        {
            return (string)obj.GetValue(HelpContextProperty);
        }
        #endregion

        private static void triggerHelp(object sender, MouseButtonEventArgs eventArgs)
        {
            //TODO: Trigger the help
        }

    }
}
